package com.jyserver.common.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "返回参数", description = "单条记录")
public class ResultMsg<T> {
    @ApiModelProperty(value = "请求结果",example="100")
    private int code = 100;

    @ApiModelProperty(value = "描述")
    private String msg = "请求成功";

    @ApiModelProperty(value = "返回数据")
    private T data;

    @ApiModelProperty(value = "操作处理是否成功")
    private boolean succeed = true;


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {

        return msg;
    }

    public boolean isSucceed() {
        return succeed;
    }

    public void setSucceed(boolean succeed) {
        this.succeed = succeed;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public ResultMsg(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultMsg(int code, String msg, T data, boolean succeed) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.succeed = succeed;
    }

    public ResultMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = null;
    }

    public ResultMsg(T data) {
        this.data = data;
    }

    public ResultMsg(String msg) {
        this.msg = msg;
    }

    public ResultMsg(String msg, boolean succeed) {
        this.msg = msg;
        this.succeed = succeed;
    }
}
